package cn.asiontang.xposed.url_firewall;

import cn.asiontang.xposed.LogEx;
import cn.asiontang.xposed.XposedUtils;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.callbacks.XC_LoadPackage;

/**
 *
 */
public class XposedHookClass_okhttp3
{
    private static final String TAG = XposedHookClass_okhttp3.class.getName();

    /**
     * <pre>
     * 此方法优点:
     *      1.
     * 此方法缺点:
     *      1.
     * </pre>
     */
    public static void hook(final XC_LoadPackage.LoadPackageParam loadPackageParam)
    {
        try
        {
            XposedUtils.realHookAllConstructors("okhttp3.Request", loadPackageParam.classLoader, new XC_MethodHook()
            {
                @Override
                protected void afterHookedMethod(final MethodHookParam param) throws Throwable
                {
                    LogEx.log(TAG, "成功捕获网址:", "okhttp3.Request", param.thisObject);
                }
            });
        }
        catch (Throwable e)
        {
            LogEx.log(TAG, "hook Exception", e);
        }
    }
}
